using System;

namespace BSDS.Core.Data.Local
{
    public class DataFormat
    {
        public static DataFormat Xml = new DataFormat("xml");
        public static DataFormat Tab = new DataFormat("tab");
        public static DataFormat Pipe = new DataFormat("pipe");
        public static DataFormat Comma = new DataFormat("csv");
        public static DataFormat OriginalFormat = new DataFormat("");

        public string Value { get; private set; }

        private DataFormat(string value)
        {
            Value = value;
        }

        public static DataFormat Parse(string value)
        {
            switch (value)
            {
                case "xml": 
                    return Xml;
                case "tab": 
                    return Tab;
                case "pipe": 
                    return Pipe;
                case "csv": 
                    return Comma;
                default:
                    throw new ArgumentOutOfRangeException("Unrecognized file format: " + value);
            }
        }
    }
}